import 'dart:convert';

HistoryModel collectionsModelFromJson(String str) => HistoryModel.fromJson(json.decode(str));

String collectionsModelToJson(HistoryModel data) => json.encode(data.toJson());

class HistoryModel {
  int code;
  String ? msg;
  List<HistoryData> ? data;

  HistoryModel({
    required this.code,
    this.msg,
    this.data,
  });

  factory HistoryModel.fromJson(Map<String, dynamic> json) => HistoryModel(
    code: json["code"],
    msg: json["msg"],
    data: List<HistoryData>.from(json["data"].map((x) => HistoryData.fromJson(x))),
  );

  Map<String, dynamic> toJson() => {
    "code": code,
    "msg": msg,
    "data": List<dynamic>.from(data!.map((x) => x.toJson())),
  };
}

class HistoryData {
  int id;
  int tid;
  String name;
  String ename;
  String meaning;
  String description;
  double price;
  int inventory;
  String coverUrl;
  String img1;
  String img2;
  String img3;
  int status;
  String createTime;

  HistoryData({
    required this.id,
    required this.tid,
    required this.name,
    required this.ename,
    required this.meaning,
    required this.description,
    required this.price,
    required this.inventory,
    required this.coverUrl,
    required this.img1,
    required this.img2,
    required this.img3,
    required this.status,
    required this.createTime,
  });

  factory HistoryData.fromJson(Map<String, dynamic> json) => HistoryData(
    id: json["id"],
    tid: json["tid"],
    name: json["name"],
    ename: json["ename"],
    meaning: json["meaning"],
    description: json["description"],
    price: json["price"],
    inventory: json["inventory"],
    coverUrl: json["coverUrl"],
    img1: json["img1"],
    img2: json["img2"],
    img3: json["img3"],
    status: json["status"],
    createTime: json["createTime"]
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "tid,": tid,
    "name": name,
    "ename": ename,
    "meaning": meaning,
    "description": description,
    "price": price,
    "inventory": inventory,
    "coverUrl": coverUrl,
    "img1": img1,
    "img2": img2,
    "img3": img3,
    "status": status,
    "createTime": createTime,
  };
}
